<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="zh-CN">
<head>
<link rel="stylesheet" href="<%=path%>/css/manager/bbs_economist2.css">
<script type="text/javascript"
	src="<%=path%>/js/manager/jquery-1.8.2.js"></script>
<script type="text/javascript" src="<%=path%>/js/jedate/jedate.js"></script>
<!-- ueditor编辑器 -->
<script type="text/javascript" charset="utf-8" src="/forumsystem/js/utf8-jsp/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="/forumsystem/js/utf8-jsp/ueditor.all.min.js"> </script>
<!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
<!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
<script type="text/javascript" charset="utf-8" src="/forumsystem/js/utf8-jsp/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript">
	//实例化编辑器
	 var ue = UE.getEditor('editor');
	//对编辑器的操作最好在编辑器ready之后再做
	 ue.ready(function() {
	     //设置编辑器的内容
	     ue.setContent($("#bbsIntroduce").val());
	     //获取html内容，返回: <p>hello</p>
	     var html = ue.getContent();
	      
	 });
	<%--  <script id="editor" type="text/plain" style="width:1024px;height:500px;"></script>
	 <input type="hidden" id="newsContent"  name="newsContent" value='${news.newsContent}'/> --%>
</script>
<title>论坛学人管理</title>
</head>
<body>
	<!--
        	作者：offline
        	时间：2016-12-22
        	描述：论坛学人管理内容头部
        -->
	<div class="bbs_mist_div1">论坛学人管理</div>
	<div class="bbs_mist2_div2">
		<div class="news3_div2_div1">
			<span class="news3_div2_div1_sp1"><c:if
					test="${bbs.markManage==1}">添加</c:if><c:if test="${bbs.markManage==2}">编辑</c:if>学人</span>
		</div>
		<form action="bbsmange.htm" id="sform" method="post">
			<input type="hidden" name="condition" value="${bbs.condition}" />
				<input type="hidden" id="pageIndex" name="pageInfo.pageIndex"
					value="${bbs.pageInfo.pageIndex}" />
				<input type="hidden" id="pageSize" name="pageInfo.pageSize"
					value="${bbs.pageInfo.pageSize}" />
			<input type="hidden" id="markManage" name="markManage"
				value="${bbs.markManage}" /> <input type="hidden" id="bbsId"
				name="bbsId" value="${bbs.bbsId}" /> <input type="hidden"
				id="sysuserId" name="bbsAdduser" value="${back_user.sysuserId}" />
			<div class="news2_div2_div2">
				<div class="news2_div2_div2_div1">学人名称</div>
				<input class="news2_div2_div2_in1" type="text" placeholder="输入学人名称"
					maxlength="30" id="bbsName" name="bbsName" value="${bbs.bbsName}" />
				<div class="news2_div2_div2_div2">
					还能输入<em>30</em>个字
				</div>
			</div>
			<div class="bbs_mist2_div2_div1">
				<div class="bbs_mist2_div2_div1_div1">学人照片</div>
				<div class="bbs_mist2_div2_div1_div2">
					<img id="imagez" src="/upload/images/bbs/${bbs.bbsImg}" />
					<div class="bbs_mist2_div2_div1_div2_div1">
						<input type="button" /> <input class="shangchuan_in1" type="file"
							onchange="selectImagez(this);" id="" />

						<p>建议的图片尺寸为：140px*140px</p>
						<p>格式要求：jpg ,gif , png</p>
					</div>
					<input type="hidden" name="bbsImg" id="bbsImg"
						value="${bbs.bbsImg}" /> <input type="hidden" name="oldImg"
						id="oldImg" value="${bbs.bbsImg}" disabled="disabled" />
				</div>
			</div>
			<div class="news2_div2_div3">
				<div class="news2_div2_div3_div1">学人简历</div>
				<div class="news2_div2_div3_div2">
					<p class="news2_div2_div3_div2_p1">1、图片尺寸为：每张图片不超过1024kb，仅支持jpg.jpeg.和png.格式；</p>
					<p class="news2_div2_div3_div2_p2">2、图片要清晰，不能虚化。</p>
					<div class="">
						<%-- <textarea id="bbsIntroduce" name="bbsIntroduce">${bbs.bbsIntroduce}</textarea> --%>
							<script id="editor" type="text/plain" style="width:1024px;height:500px;"></script>
						    <input type="hidden" id="bbsIntroduce"  name="bbsIntroduce" value='${bbs.bbsIntroduce}'/>
					</div>
				</div>
			</div>

			<div class="news2_div2_div5">
				<input class="news2_div2_div5_in1" type="submit"
					onclick="return submitCheck()" value="" /> <input
					class="news2_div2_div5_in2" type="button" onclick="return back()" />
			</div>
		</form>
	</div>
</body>
<script type="text/javascript">
	//提交验证
	function submitCheck() {
		 var content=ue.getContent();
		$("#bbsIntroduce").val(content);
		//验证管理员登录
		var sysuserId=$("#sysuserId").val();
		if(sysuserId.length==0){
			alert("管理员登录失效，请重新登录");
			window.location.href="<%=path%>/login/beforelogin.htm";
			return false;
		}
		//标题
		var bbsName = $.trim($("#bbsName").val());
		if (bbsName.length == 0) {
			alert("学人姓名不能为空！");
			$("#bbsName").focus();
			return false;
		} else {
			$("#bbsName").val(bbsName);
		}
        //学人头像
		var bbsImg=$("#bbsImg").val();
        if(bbsImg.length==0){
        	alert("请上传学人照片！");
			return false;
        }
       
		return true;
	}
	//返回事件
	function back() {
		$("#sform").attr("action", "bbslist.htm");
		$("#sform").submit();
	}
	//上传头像
	function selectImagez(file) {
		//控制显示oldImg路径
		$('#oldImg').attr("disabled",false); 
		if (!file.files || !file.files[0]) {
			return;
		}
		var image = '';
		var reader = new FileReader();
		reader.onload = function(evt) {
			document.getElementById('imagez').src = evt.target.result;
			image = evt.target.result;
			$.ajax({
				type : "post",
				url : '<%=path%>/imageController/updateImg.htm',
				data : {
					image : image,
					oldImg : file.id,
					path : "/upload/images/bbs/"
				},
				async : false,
				dataType : 'json',
				success : function(data) {
					$("#bbsImg").val(data);
					$("#oldImg").val(data);
					file.id = data;
				},
				error : function(err) {
					alert('网络故障');
				}
			});
		}
		reader.readAsDataURL(file.files[0]);
		return false;
	}
</script>
</html>

